import os

from common import addVersion, changeApi
from buildAndroidApk import buildAndroidApk
from buildWgt import buildWgt
from buildMini import buildMini
from buildIosIpa import buildIosIpa

new_version_code, new_version_name = addVersion()

# 打包环境
env = "prod"
# 工程路径
projectPath = "C:/Users/Administrator/Documents/HBuilderProjects/testYSP"
# devapi
devapi = "https://test.api.com"
# prodapi
prodapi = "https://api.com"
# wgt路径
wgtPath = "C:/Users/Administrator/Documents/HBuilderProjects/testYSP/WGT"
# 工程名称
projectName = "测试打包"
# 是发布小程序还是app  1:小程序 2:wgt 3:android apk 4:ios ipa
buildWay = [1, 3]
# 版本号
version = new_version_name


# 修改版本号
addVersion()
# 修改api
if env != "dev":
    changeApi(projectPath, devapi, prodapi)

# 打包android apk
if 3 in buildWay:
    buildAndroidApk(projectPath)

# 打包ios ipa
if 4 in buildWay:
    buildIosIpa(projectPath)


# 打包wgt

if 2 in buildWay:
    buildWgt(wgtPath, projectName, version)

# 发布小程序

if 1 in buildWay:
    buildMini(projectName, version)
